﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="GPSCommands.aspx.cs" Inherits="GPSTrackingWebsiteManager.Manager.Pages.GPSCommands" %>

<!DOCTYPE html>
<link href="../../Css/GPSTrackingWebsite.css" rel="stylesheet" />
<link href="../../Css/messi.css" rel="stylesheet" />
<script src="../../Javascript/jquery-1.11.1.min.js"></script>
<script src="../../Javascript/messi.js"></script>
<script src="../../Javascript/Custom.js"></script>
<script src="../../Javascript/WindowMessageManager.js"></script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>SMS Comandos</title>
    <telerik:RadScriptBlock ID="RadScriptBlock3" runat="server">
        <script type="text/javascript">
            function resizeGrid() {                

            var height = (window.innerHeight);

            var tableView = $find("<%=GPSModelsGrid.ClientID %>");
                tableView.get_element().style.height = (height) + "px";

            var tableView2 = $find("<%=GPSCommandGrid.ClientID %>");
                tableView2.get_element().style.height = (height) + "px";

            document.getElementById('HiddenFieldHeight').value = (height);
            
        }

        //Windows Message Manager 
        var objWindowsMessageManager = new WindowsMessageManager();
        </script>
    </telerik:RadScriptBlock>
</head>
<body onresize="resizeGrid()">
    <form id="form1" runat="server" style="overflow: hidden">

        <telerik:RadScriptManager ID="RadScriptManager1" runat="server"></telerik:RadScriptManager>
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" DefaultLoadingPanelID="RadAjaxLoadingPanel1">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="GPSModelsGrid">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="rmpGPSModels"  />
                        <telerik:AjaxUpdatedControl ControlID="HiddenFieldError" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                 <telerik:AjaxSetting AjaxControlID="GPSCommandGrid">
                    <UpdatedControls>                        
                        <telerik:AjaxUpdatedControl ControlID="GPSCommandGrid" />
                        <telerik:AjaxUpdatedControl ControlID="HiddenFieldError" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server"></telerik:RadAjaxLoadingPanel>
        <asp:HiddenField ID="HiddenFieldHeight" runat="server" Value="500" />        
        <asp:HiddenField ID="HiddenFieldError" runat="server" />

        <telerik:RadTabStrip ID="rtsGPSModels" runat="server" SelectedIndex="0" MultiPageID="rmpGPSModels" ></telerik:RadTabStrip>
        <telerik:RadMultiPage ID="rmpGPSModels" runat="server" SelectedIndex="0">
        <telerik:RadPageView ID="rpvGPSModels" runat="server">

        <table border="0" CellSpacing="0" GridLines="None">
            <tr>
                <td><telerik:RadGrid ID="GPSModelsGrid" runat="server" AutoGenerateColumns="false" CellSpacing="0" GridLines="None" Height="100%" Width="100%" GroupingSettings-CaseSensitive="false" AllowSorting="true" OnNeedDataSource="GPSModelsGrid_NeedDataSource" OnSelectedIndexChanged="GPSModelsGrid_SelectedIndexChanged" OnItemCommand="GPSModelsGrid_ItemCommand">
                <MasterTableView EditMode="PopUp" EditFormSettings-PopUpSettings-Modal="true" EditFormSettings-CaptionFormatString="Modo Edición" CommandItemDisplay="TopAndBottom" NoMasterRecordsText="No hay registros" AllowFilteringByColumn="true" TableLayout="Auto">
                    <CommandItemTemplate>
                        <div style="padding: 5px 5px;">
                            Tipo Dispositivo:                              
                             <asp:LinkButton ID="lbClearFilters" runat="server" OnClick="lbClearFilters_Click" Visible='<%# !GPSModelsGrid.MasterTableView.IsItemInserted %>'><img style="padding-left:10px; padding-right:5px; vertical-align:middle" alt="" src="../../Template/Icons/16px/mixx-icon.png"/>Limpiar Filtros</asp:LinkButton>
                            <asp:LinkButton ID="lbShowError" runat="server" OnClick="lbShowError_Click" Visible='<%# HiddenFieldError.Value == string.Empty ? false : true %>'><img style="padding-left:10px; padding-right:5px; vertical-align:middle" alt="" src="../../Template/Icons/16px/bug-icon.png"/>Error técnivo</asp:LinkButton>
                        </div>
                    </CommandItemTemplate>
                    <CommandItemSettings ExportToPdfText="Export to PDF" AddNewRecordText="Nuevo dispositivo" RefreshText="Actualizar"></CommandItemSettings>
                    <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
                        <HeaderStyle Width="20px"></HeaderStyle>
                    </RowIndicatorColumn>

                    <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
                        <HeaderStyle Width="20px"></HeaderStyle>
                    </ExpandCollapseColumn>

                    <Columns>
                        <telerik:GridButtonColumn UniqueName="SelectColumn" CommandName="Select" Text="Seleccionar" HeaderStyle-Width="30px" ButtonType="ImageButton" ImageUrl="../../Template/Icons/16px/Win-Command-Prompt-icon.png" />
                        <telerik:GridBoundColumn DataField="GpsModelId" FilterControlAltText="Filter Imei column" HeaderText="GpsModelId" UniqueName="GpsModelId" Display="false" ForceExtractValue="Always">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Name" FilterControlAltText="Filter Name column" HeaderText="Nombre" UniqueName="Name"
                             FilterControlWidth="100px" CurrentFilterFunction="Contains" ShowFilterIcon="false"  HeaderStyle-Width="130px" AutoPostBackOnFilter="true">                        
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Port" FilterControlAltText="Filter SimNumber column" HeaderText="Puerto" UniqueName="Port"
                             FilterControlWidth="100px" CurrentFilterFunction="EqualTo" ShowFilterIcon="false"  HeaderStyle-Width="130px" AutoPostBackOnFilter="true">
                           
                        </telerik:GridBoundColumn>
                    </Columns>
                </MasterTableView>

                <ClientSettings EnableRowHoverStyle="true" EnablePostBackOnRowClick="true">
                    <Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="True"></Scrolling>
                     <Selecting AllowRowSelect="True"></Selecting><ClientEvents OnPopUpShowing="PopUpShowing" />
                </ClientSettings>
                <FilterMenu EnableImageSprites="False"></FilterMenu>
            </telerik:RadGrid></td><td>&nbsp</td>
                <td><telerik:RadGrid ID="GPSCommandGrid" runat="server" AutoGenerateColumns="False" CellSpacing="0" GridLines="None" Height="100%" Width="100%" GroupingSettings-CaseSensitive="false" AllowSorting="true" OnNeedDataSource="GPSCommandGrid_NeedDataSource" Enabled="False" OnDeleteCommand="GPSCommandGrid_DeleteCommand" OnInsertCommand="GPSCommandGrid_InsertCommand" OnUpdateCommand="GPSCommandGrid_UpdateCommand">
                <MasterTableView EditMode="PopUp" EditFormSettings-PopUpSettings-Modal="true" EditFormSettings-CaptionFormatString="Modo Edición" CommandItemDisplay="TopAndBottom" NoMasterRecordsText="No hay registros" AllowFilteringByColumn="true" TableLayout="Auto">
                    <CommandItemTemplate>
                        <div style="padding: 5px 5px;">
                            Menu: 
                             <asp:LinkButton ID="lbAdd" runat="server" CommandName="InitInsert" Visible='<%# !GPSCommandGrid.MasterTableView.IsItemInserted %>'><img style="padding-left:10px; padding-right:5px; vertical-align:middle" alt="" src="../../Template/Icons/16px/text-plus-icon.png"/>Nuevo Comando</asp:LinkButton>
                            <asp:LinkButton ID="lbClearFilters" runat="server" OnClick="lbClearFilters2_Click" Visible='<%# !GPSCommandGrid.MasterTableView.IsItemInserted %>'><img style="padding-left:10px; padding-right:5px; vertical-align:middle" alt="" src="../../Template/Icons/16px/mixx-icon.png"/>Limpiar Filtros</asp:LinkButton>
                            <asp:LinkButton ID="lbShowError" runat="server" OnClick="lbShowError_Click" Visible='<%# HiddenFieldError.Value == string.Empty ? false : true %>'><img style="padding-left:10px; padding-right:5px; vertical-align:middle" alt="" src="../../Template/Icons/16px/bug-icon.png"/>Error técnivo</asp:LinkButton>
                        </div>
                    </CommandItemTemplate>
                    <CommandItemSettings ExportToPdfText="Export to PDF" AddNewRecordText="Nuevo dispositivo" RefreshText="Actualizar"></CommandItemSettings>

                    <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
                        <HeaderStyle Width="20px"></HeaderStyle>
                    </RowIndicatorColumn>

                    <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
                        <HeaderStyle Width="20px"></HeaderStyle>
                    </ExpandCollapseColumn>

                    <Columns>
                          <telerik:GridEditCommandColumn ButtonType="ImageButton" EditText="Editar" HeaderStyle-Width="25px" />
                        <telerik:GridButtonColumn  ConfirmText="¿Desea eliminar el registro?" Text="Eliminar" ConfirmDialogType="RadWindow" ConfirmDialogHeight="120" ConfirmDialogWidth="270" ConfirmTitle="Eliminar" ButtonType="ImageButton" CommandName="Delete" HeaderStyle-Width="25px"/>                                                     
                        <telerik:GridBoundColumn DataField="GpsCommandId" FilterControlAltText="Filter GPSModelID column" HeaderText="GpsCommandId" UniqueName="GpsCommandId" ReadOnly="true" Visible="false" ForceExtractValue="Always">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="GpsModelId" FilterControlAltText="Filter Imei column" HeaderText="GpsModelId" UniqueName="GpsModelId" Visible="false" ReadOnly="true" ForceExtractValue="Always">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="OrderCommand" FilterControlAltText="Filter Name column" HeaderText="Secuencia SMS" UniqueName="OrderCommand"
                            FilterControlWidth="100px" CurrentFilterFunction="EqualTo" ShowFilterIcon="false" HeaderStyle-Width="130px" AutoPostBackOnFilter="true">
                            <ColumnValidationSettings EnableRequiredFieldValidation="true">
                                <RequiredFieldValidator ForeColor="Red" ErrorMessage="* Requerido" SetFocusOnError="true"></RequiredFieldValidator>
                            </ColumnValidationSettings>
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="CommandText" FilterControlAltText="Filter Port column" HeaderText="Command SMS" UniqueName="CommandText" MaxLength="50"
                            FilterControlWidth="160px" CurrentFilterFunction="Contains" ShowFilterIcon="false" HeaderStyle-Width="190px" AutoPostBackOnFilter="true">
                            <ColumnValidationSettings EnableRequiredFieldValidation="true">
                                <RequiredFieldValidator ForeColor="Red" ErrorMessage="* Requerido" SetFocusOnError="true"></RequiredFieldValidator>
                            </ColumnValidationSettings>
                        </telerik:GridBoundColumn>
                    </Columns>

                    <EditFormSettings>
                        <EditColumn InsertText="Agregar" UpdateText="Actualizar" CancelText="Cancelar" ButtonType="ImageButton"></EditColumn>
                    </EditFormSettings>
                </MasterTableView>
                <ClientSettings EnableRowHoverStyle="true">
                    <Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="True"></Scrolling>
                     <Selecting AllowRowSelect="True"></Selecting><ClientEvents OnPopUpShowing="PopUpShowing" />
                </ClientSettings>
                <FilterMenu EnableImageSprites="False"></FilterMenu>
            </telerik:RadGrid>
            </tr>
        </table>
        </telerik:RadPageView>
        </telerik:RadMultiPage>
    </form>
</body>
</html>
